package cn.bb.springboothello.controller;

import cn.bb.springboothello.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

/*
* springboot整合jsp
* */
@Controller
public class UserController {
    /*
    *处理请求产生数据
     */
    @RequestMapping("/showUser")
    public String showUser(Model model){
        List<User> list =new ArrayList<>();
        list.add(new User(1,"zhangsan",20));
        list.add(new User(2,"lisi",21));
        list.add(new User(3,"wangwu",22));
        //需要一个model对象
        model.addAttribute("list",list);
        //跳转视图
        return "userlist";
    }
}
